<template>
  <div>
    <p>{{store.state.age}}</p>
    <button @click="add">同步加</button>
    <button @click="cut">同步赋值1</button>
    <button @click="asAdd">异步加</button>
    <button @click="asCut">异步赋值1</button>
  </div>
</template>

<script setup>
// import { reactive, ref, toRefs } from 'vue';
import { useStore } from 'vuex'
const store = useStore()

console.log(store.state.age)

let add = () => {
  store.commit('addAge')
}
let cut = () => {
  store.commit('cutAge', 1)
}
let asAdd = () => {
  store.dispatch('asaddAge')
}
let asCut = () => {
  store.dispatch('ascutAge', 1)
}

</script>
<style scoped lang ='less'>
</style>